package com.xg.controller;


import com.xg.common.result.ApiResult;
import com.xg.entity.UsedCar;
import com.xg.entity.UsedCarBrand;
import com.xg.entity.UsedCarSeries;
import com.xg.service.IUsedCarSeriesService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;

import org.springframework.stereotype.Controller;
import java.util.List;


/**
 * <p>
 * 前端控制器
 * </p>
 *
 * @author jdh
 * @since 2023-03-30
 */
@Controller
@RequestMapping("/usedCarSeries")
public class UsedCarSeriesController {
    @Autowired
    private IUsedCarSeriesService iUsedCarSeriesService;

    /**
     * @return
     * @Author 罗迎庆
     * @Methodname
     * @Description //TODO (车系查询)
     * @Date 21:20 2023/3/30
     * @Param
     **/
    @RequestMapping("/queryUsedCarSeriesList")
    public String queryUsedCarSeriesList(Model model) {
        List<UsedCarSeries> list = iUsedCarSeriesService.queryUsedCarSeriesList();
        model.addAttribute("seriesList",list);
        return "PurchaseCar";
    }
    
    /**
     * @Author 罗迎庆
     * @Methodname queryUsedCarSeriesById       
     * @Description //TODO (根据车系id来查询used_car表)
     * @Date 17:46 2023/4/5
     * @Param [model, seriesId]
     * @return java.lang.String
     **/
    @RequestMapping("queryUsedCarSeriesById")
    public String queryUsedCarSeriesById(Model model,Integer seriesId) {
        List<UsedCar> list = iUsedCarSeriesService.queryUsedCarSeriesById(seriesId);
        model.addAttribute("usedSeriesList",list);
        return "PurchaseCar";
    }

}
